//
//  YZClickOptionBtn.m
//  VET
//
//  Created by 刘文靖 on 2018/7/23.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZClickOptionBtn.h"
#import "YZLineView.h"
@interface YZClickOptionBtn()
@property (nonatomic, strong) UILabel *descLabel;
@property (nonatomic, strong) UILabel *optionLabel;
@end

@implementation YZClickOptionBtn

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setupUI];
    }
    
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    
    self = [super initWithCoder:aDecoder];
    if (self) {
        
        [self setupUI];
    }
    
    return self;
}

- (instancetype)initWithDescStr:(NSString *)descStr{
    self = [super init];
    if (self) {
        _descStr = descStr;
        _descLabel.text = descStr;
    }
    
    return self;
}

- (void)setupUI{
    self.backgroundColor = kColorWithHex(0xffffff);
    
    self.descLabel = [[UILabel alloc] init];
    self.descLabel.textColor = kColorWithHex(0x393939);
    self.descLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:16];
    [self addSubview:self.descLabel];
    [self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(17);
        make.centerY.offset(0);
    }];
    
    UILabel *starLabel = [[UILabel alloc] init];
    starLabel.text = @"*";
    starLabel.textColor = kColorWithHex(0xFF5656);;
    starLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:12];;
    [self addSubview:starLabel];
    [starLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.descLabel);
        make.size.mas_equalTo(CGSizeMake(6.5, 6.5));
        make.left.mas_equalTo(self.descLabel.mas_right).offset(9);
    }];
    
    UIImageView *arrowIV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ico_right"]];
    [self addSubview:arrowIV];
    [arrowIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.right.offset(-23);
    }];
    
    YZLineView *lineView = [[YZLineView alloc] init];
    [self addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(.5);
        make.left.offset(12);
        make.centerX.bottom.offset(0);
    }];
    
    self.optionLabel = [[UILabel alloc] init];
    self.optionLabel.textColor = kColorWithHex(0x393939);
    self.optionLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:16];
    [self addSubview:self.optionLabel];
    [self.optionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-41);
        make.centerY.offset(0);
    }];
}

- (void)setDescStr:(NSString *)descStr{
    _descStr = descStr;
    self.descLabel.text = descStr;
}

- (void)setOptionStr:(NSString *)optionStr{
    _optionStr = optionStr;
    self.optionLabel.text = optionStr;
}


@end
